package com.hejjon.core.enumer;

import lombok.Getter;

@Getter
public enum PublishStatusEnum {

    NEW_PUBLISH("new_publish", "新发布"),

    PUBLISHEED("published", "已发布"),

    UNPUBLISH("unpublish", "未发布"),

    UPDATE_PUBLISH("update_publish", "更新发布");

    private final String code;

    private final String name;

    PublishStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }


    public static PublishStatusEnum getInstance(String code) {
        for (PublishStatusEnum value : PublishStatusEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return NEW_PUBLISH;
    }

}
